﻿using System;
using System.Collections.Generic;
using yiCommerce.Core.Domain.Addresses;
using yiCommerce.Core.Domain.Customers;
using yiCommerce.Core.Domain.Payments;
using yiCommerce.Core.Domain.Shippings;
using yiCommerce.Core.Domain.Shops;
using yiCommerce.Core.Domain.Tradings;

namespace yiCommerce.Core.Domain.Orders
{
    public class Order:BaseEntity
    {
        public virtual int ShopId { get; set; }

        public virtual Shop Shop { get; set; }


        public virtual bool Deleted { get; set; }

        public virtual int CustomerId { get; set; }
        public virtual Customer Customer { get; set; }

        public virtual Guid OrderGuid { get; set; }


        public virtual decimal OrderShippingPrice { get; set; }

        public virtual decimal OrderTotal { get; set; }

        public virtual decimal RefundedAmount { get; set; }

        /// <summary>
        /// Gets or sets an order status identifier
        /// </summary>
        public virtual int OrderStatusId { get; set; }

        /// <summary>
        /// Gets or sets the shipping status identifier
        /// </summary>
        public virtual int ShippingStatusId { get; set; }

        /// <summary>
        /// Gets or sets the payment status identifier
        /// </summary>
        public virtual int PaymentStatusId { get; set; }



        public virtual OrderStatus OrderStatus
        {
            get { return (OrderStatus)this.OrderStatusId; }
            set { this.OrderStatusId = (int)value; }
        }

        /// <summary>
        /// Gets or sets the payment status
        /// </summary>
        public virtual PaymentStatus PaymentStatus
        {
            get { return (PaymentStatus)this.PaymentStatusId; }
            set { this.PaymentStatusId = (int)value; }
        }

        /// <summary>
        /// Gets or sets the shipping status
        /// </summary>
        public virtual ShippingStatus ShippingStatus
        {
            get { return (ShippingStatus)this.ShippingStatusId; }
            set { this.ShippingStatusId = (int)value; }
        }


        public  virtual string PaymentMethodSystemName { get; set; }


        public  virtual DateTime? PaidDateUtc { get; set; }


        public  virtual Address ShippingAddress { get; set; }
        public  virtual int? ShippingAddressId { get; set; }

        public  virtual DateTime CreatedOnUtc { get; set; }

        private ICollection<OrderProductVariant> _orderProductVariant;
        /// <summary>
        /// Gets or sets order product variants
        /// </summary>
        public virtual ICollection<OrderProductVariant> OrderProductVariants
        {
            get { return _orderProductVariant ?? (_orderProductVariant = new List<OrderProductVariant>()); }
            protected set { _orderProductVariant = value; }
        }


        private ICollection<TradingOrder> _tradings;
        public virtual ICollection<TradingOrder> Tradings 
        {
            get { return _tradings ?? (_tradings = new List<TradingOrder>()); }
            set { _tradings = value; }
        }


    }
}